import React from "react";
import styled from 'styled-components';
import CommonCard from "@/components/CommonCard/CommonCard";
import { Button, Table, TableColumnProps, Tag } from '@arco-design/web-react';
import { IconInfoCircle } from "@arco-design/web-react/icon";
import UserOrder from "@/configs/user.json";

const Wrapper = styled.div`
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: rgb(54, 54, 54);
    padding: 16px;
`;

const ButtonWrapper = styled.div`
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
`;

const UserManage = () => {

    const columns: TableColumnProps[] = [
        {
            width: '80px',
            title: '序号',
            dataIndex: 'index',
        },
        {
            width: '200px',
            title: '用户名',
            dataIndex: 'name',
        },
        {
            width: '100px',
            title: '权限',
            dataIndex: 'permission',
        },
        {
            width: '250px',
            title: '手机号',
            dataIndex: 'phone',
        },
        {
            title: '用户注册时间',
            dataIndex: 'createTime',
        },
        {
            width: '250px',
            title: '操作',
            render: (value, col) => {
                return <ButtonWrapper>
                    <Button icon={<IconInfoCircle />} style={{ marginRight: '12px' }}>详情</Button>
                    <Button icon={<IconInfoCircle />} style={{ marginRight: '12px' }}>联系</Button>
                </ButtonWrapper>
            },
        }
    ];

    return (
        <Wrapper>
            <CommonCard
                title="用户管理"
            >
                <Table style={{ width: '100%' }} columns={columns} rowKey={(row) => row.index} data={UserOrder.data} scroll={{ x: 1200 }}/>;
            </CommonCard>
        </Wrapper>
    )
}


export default UserManage;